﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>

<%@ Import Namespace="OAclient.Common" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>CardDetail</title>
    <!--Fckeditor-->

    <script src="../../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>

    <script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script>

    <script src="../../Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>

    <script src="../../Scripts/fckeditor/ckfinder/ckfinder.js" type="text/javascript"></script>

    <script src="../../Scripts/fckeditor/ckeditor/adapters/jquery.js" type="text/javascript"></script>

    <script src="../../Scripts/fckeditor/ckeditor/ckeditor.js" type="text/javascript"></script>

</head>
<body>
    <div id="header">
        <div id="loginer">
            <%Html.RenderPartial("LogOnUserControl"); %>
        </div>
    </div>
    <%var cardInfo = ViewData["card_info"] as Dictionary<String, Object>; %>
    <div id="main">
        <div id="CardDetail">
            <div id="InitCard">
                <div id="card_title">
                    <%=cardInfo["card_title"]%></div>
                <div id="user_name">
                    <%=cardInfo["user_name"]%></div>
                <div id="init_time">
                    <%=cardInfo["init_time"]%></div>
                <div id="card_text">
                    <%=cardInfo["card_text"]%></div>
            </div>
            <div id="ReplyCards">
                <%--<%Html.RenderAction("GetReplyCards", "BBS", new { inCardId = cardInfo["card_id"] }); %>--%>
                <%var replyCards = cardInfo["reply_card"] as List<CommonLibrary.DataModel.BBS.ReplyCardEntity>; %>
                <%
                    if (replyCards != null)
                    {
                        foreach (var replyCard in replyCards)
                        { %>
                <p>
                    <%=replyCard.BuildCount%>
                    <%if (ViewData["mng"] == "true")
                      { %>
                    <%=Html.ActionLink("删除", "DelReplyCard", new { inCardId = cardInfo["card_id"],reCardId=replyCard.CardId })%>
                    <%} %>
                </p>
                <p>
                    <%=replyCard.User.name%></p>
                <p>
                    <%=replyCard.ReplyTime%></p>
                <p>
                    <%=Server.HtmlDecode(replyCard.CardText)%></p>
                <%}
                    }%>
            </div>
            <div id="pager">
                <%var pageInfo = ViewData["pageInfo"] as PagingInfo; %>
                <%if (pageInfo != null)
                  { %>
                <%=Html.PageLinks(pageInfo, index => Url.Action("CheckCard", new { inCardId = cardInfo["card_id"], page = index }))%>
                <%} %>
            </div>
        </div>
    </div>
    <div id="foot">

        <script type="text/javascript">
            function FeedBack() {
                var text = CKEDITOR.tools.htmlEncode(editor.getData());
                var inCardId = $("#inCardId").val();
                if (text == "") {
                    alert("内容不能为空");
                    return false;
                }

                $.ajax({
                    type: "POST",
                    url: "/BBS/ReplyCard",
                    data: { "inCardId": inCardId, "text": text }
                });
            }
        </script>

        <div id="FeedBack">
            <%=Html.Hidden("inCardId",cardInfo["card_id"]) %>
            <%Html.RenderPartial("Fckeditor"); %>
            <input type="button" onclick="FeedBack()" value="回复" />
        </div>
        <%=Html.ActionLink("返回首页","BBSMain","BBS") %>
    </div>
</body>
</html>
